<div style="display:flex;margin-bottom:10px;">
  <div style="margin-left:25px;padding-top: 3px;">
    <mat-icon style="padding-top: 3px;">build</mat-icon>
    <h4 style="display: inline;position: relative;top: -5px;">
      <ng-container i18n>
        Manage Services - {{ domain }}
      </ng-container>
    </h4>
  </div>
  <div style="flex: 1 1 auto">
  </div>
  <div>
    <app-controls></app-controls>
  </div>
</div>

<div style="display: flex; flex-direction: column;margin-right:25px;margin-left:25px;">
  <mat-table #table [dataSource]="dataSource">

    <ng-container matColumnDef="actions">
      <mat-header-cell *matHeaderCellDef [ngClass]="'actionWidth'">
        <ng-container i18n>
          &nbsp;
        </ng-container>
      </mat-header-cell>
      <mat-cell *matCellDef="let row" [ngClass]="'actionWidth'">
        <button mat-icon-button [matMenuTriggerFor]="serviceMenu" (click)="selectedItem = row">
          <mat-icon>menu</mat-icon>
        </button>
      </mat-cell>
    </ng-container>

    <ng-container matColumnDef="name">
      <mat-header-cell *matHeaderCellDef [ngClass]="'nameWidth'">
        <ng-container i18n>
          Name
        </ng-container>
      </mat-header-cell>
      <mat-cell *matCellDef="let row" [ngClass]="'nameWidth'">
        <a (click)="serviceEdit(row)">
          {{ row.name }}
        </a>
      </mat-cell>
    </ng-container>

    <ng-container matColumnDef="serviceId">
      <mat-header-cell *matHeaderCellDef [ngClass]="'serviceIdWidth'">
        <ng-container i18n>
          Service Url
        </ng-container>
      </mat-header-cell>
      <mat-cell *matCellDef="let row" [ngClass]="'serviceIdWidth'">
        {{ row.serviceId }}
      </mat-cell>
    </ng-container>

    <ng-container matColumnDef="description">
      <mat-header-cell *matHeaderCellDef [ngClass]="'descriptionWidth'">
        <ng-container i18n>
          Description
        </ng-container>
      </mat-header-cell>
      <mat-cell *matCellDef="let row" [ngClass]="'descriptionWidth'">
        {{ row.description }}
      </mat-cell>
    </ng-container>


    <mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
    <mat-row *matRowDef="let row; columns: displayedColumns;" [ngClass]="row.status"></mat-row>
  </mat-table>

  <mat-paginator #paginator
                 [pageSize]="10"
                 [pageSizeOptions]="[5, 10, 25, 100]">
  </mat-paginator>
</div>

<mat-menu #serviceMenu>
  <button mat-menu-item (click)="serviceEdit()">
    <mat-icon>edit</mat-icon>
    <ng-container i18n="management.services.table.button.edit">
      {{ messages.management_services_table_button_edit }}
    </ng-container>
  </button>
  <button mat-menu-item (click)="serviceDuplicate()">
    <mat-icon>content_copy</mat-icon>
    <ng-container i18n="management.services.table.button.duplicate">
      {{ messages.management_services_table_button_duplicate }}
    </ng-container>
  </button>
  <button mat-menu-item (click)="openModalDelete()">
    <mat-icon>delete</mat-icon>
    <ng-container i18n="management.services.table.button.delete">
      {{ messages.management_services_table_button_delete }}
    </ng-container>
  </button>
  <button mat-menu-item (click)="moveUp(selectedItem)" *ngIf="showMoveUp()">
    <mat-icon>arrow_upward</mat-icon>
    <ng-container>Move Up</ng-container>
  </button>
  <button mat-menu-item (click)="moveDown(selectedItem)" *ngIf="showMoveDown()">
    <mat-icon>arrow_downward</mat-icon>
    <ng-container>Move Down</ng-container>
  </button>
</mat-menu>
